#include<bits/stdc++.h>
using namespace std;
int r[100010],n,ans=0;;
bool us[100010],die[100010];
bool check(int n){
    for(int i=1;i<=n;i++){
        if(r[i]!=1&&r[i]!=2){
            return 1;
        }
    }
    return 0;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>r[i];
    }
    if(check(n)){
        sort(r,r+n+1);
        for(int i=1;i<=n;i++){
            if(die[i]==0){
                for(int j=i+1;j<=n;j++){
                    if(r[j]>r[i]&&us[j]==0&&die[j]==0){
                        die[i]=1;
                        us[j]=1;
                        break;
                    }
                }
            }
        }
        for(int i=1;i<=n;i++){
            if(die[i]==0)ans++;
        }
        cout<<ans;
    }
    else{
        for(int i=1;i<=n;i++){
            if(r[i]==2){
                ans++;
            }
        }
        if(ans*2>=n){
            cout<<ans;
        }
        else{
            cout<<ans+(n-ans-ans);
        }
    }
    return 0;
}
